[C# .NET6] AutoFac ADD implementation after DI Container Resolve


If you want to Add a implementation after DI Container resolved already,
you need to create a newBuilder and Update it to the original Container.

                var newBuilder = new ContainerBuilder();
                newBuilder.Register(c =>  new Car {Seats = GetSeats().Split(',') }).As<ICar>();
                newBuilder.Update(OriginalDIContainer);
#C# #.net6 #.net






你可能感興趣的文章

[坑] It’s MIME type ('text/html') is not a supported stylesheet MIME type

[坑] It’s MIME type ('text/html') is not a supported stylesheet MIME type

瀏覽器 CORS 與同源政策介紹

瀏覽器 CORS 與同源政策介紹

Vite系列#安裝vite&在 Composition API 及 Options API 進行切換

Vite系列#安裝vite&在 Composition API 及 Options API 進行切換






留言討論